<section class="content-header">
 <h1>添加服务模块</h1>
</section>
<section class="content">
 <!-- /.row -->
 <div class="row">
  <div class="col-xs-12">
   <div class="box box-primary">
     <div class="box-body">
      <div class="form-group">
       <label for="service_name">服务模块名称</label>
       <input type="text" class="form-control" name="name" placeholder="服务模块名称">
      </div>
      <div class="form-group">
       <label for="service_name">后端主机域名</label>
       <input type="text" class="form-control" name="host" placeholder="服务模块后端主机域名">
      </div>
      <div class="form-group">
       <label for="service_name">备注描述</label>
       <input type="text" class="form-control" name="description" placeholder="备注描述">
      </div>
     </div>
     <!-- /.box-body -->
     <div class="box-footer">
      <button id="add-service-btn" class="btn btn-primary">添加</button>
      <button class="btn btn-default" onclick="load_page('/pages/service/list.html');">取消</button>
     </div>
   </div>
   <!-- /.box -->
  </div>
 </div>
</section>
<script type="text/javascript">
    $(".content-header h1").html(domain_name+" > 添加服务模块")
    $("input[name='host']").val(domain_name);
    $("#add-service-btn").click(function(){
        api_invoke("/api/v1/service/add", {domain_id:domain_id, name:$("input[name='name']").val(),host:$("input[name='host']").val(),description:$("input[name='description']").val()}, function(data){
            if(data.errno == 0){
                load_page("/pages/service/list.html");
            }else{
                alert(data.msg);
            }
        });
    });
</script>
